import request from '@/utils/request';

// 管理员登录

export async function adminAccountLogin(params) {
  return request('/lgjserve/admin/login', {
    method: 'post',
    data: params,
  });
}

// 获取当前管理员信息
export async function queryCurrent() {
  return request(`/lgjserve/admins/info`, {
    headers: {
      Authorization: sessionStorage.token
    }
  });
}
// 获取管理员详情
export async function queryAdmininfo(params) {
  return request(`/lgjserve/admins/${params}`, {
    headers: {
      Authorization: sessionStorage.token
    }
  });
}

export async function queryAdminlist() {
  return request(`/lgjserve/admins`, {
    headers: {
      Authorization: sessionStorage.token
    }
  });
}

export async function updateAdmininfo(params) {
  return request(`/lgjserve/admins/update`, {
    headers: {
      Authorization: sessionStorage.token
    },
    method: 'post',
    data: params,
  });
}

export async function addAdmin(params) {
  return request(`/lgjserve/admins`, {
    headers: {
      Authorization: sessionStorage.token
    },
    method: 'post',
    data: params,
  });
}

export async function removeAdmin(params) {
  return request('/lgjserve/admins/setAdmin', {
    headers: {
      Authorization: sessionStorage.token
    },
    method: 'post',
    data: params,
  });
}

export async function fetchResetAdminPwd(params) {
  return request('/lgjserve/admins/resetAdminPwd', {
    headers: {
      Authorization: sessionStorage.token
    },
    method: 'post',
    data: params,
  });
}
